﻿
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using DevComponents.DotNetBar;
using shopsoft.main.AppCommon;


namespace shopsoft.main
{
    public partial class ShopSoftMain : Office2007RibbonForm
    {
        public ShopSoftMain()
        {
            InitializeComponent();
            notifyTCMS.Icon = Properties.Resources.TCMS16;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ShopSoftMain_Load(object sender, EventArgs e)
        {
            this.ribMenu.Expanded = false;

            if (this.WindowState == FormWindowState.Maximized)
            {
                this.WindowState = FormWindowState.Normal;
                this.ClientSize = SystemInformation.PrimaryMonitorSize;
            }
            else
            {
                this.FormBorderStyle = FormBorderStyle.None;
                this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
                this.WindowState = FormWindowState.Maximized;
            }
        }
        
        /// <summary>
        /// 设置是否展开二级菜单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ribMenu_SelectedRibbonTabChanged(object sender, EventArgs e)
        {
            //
            if (ribMenu.SelectedRibbonTabItem.Name == "ribbonTabItem1")
                ribMenu.Expanded = false;
            else
                ribMenu.Expanded = true;
        }

        /// <summary>
        /// 会员管理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonItem101001_Click(object sender, EventArgs e)
        {
            //
            OpenMdiChild.OpenWindow(new MemberManage.MemberInfo(), this);
        }

        #region 开始按钮中菜单事件

        /// <summary>
        /// 锁定系统
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnLockSystem_Click(object sender, EventArgs e)
        {
            //系统锁定
            Hide();
            if (new LockSystem().ShowDialog() == DialogResult.OK)
            {
                Show();
            }
        }

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnChangePwd_Click(object sender, EventArgs e)
        {
            //
        }

        /// <summary>
        /// 退出系统
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExitSystem_Click(object sender, EventArgs e)
        {
            //
            Application.Exit();
        }

        #endregion     

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void notifyTCMS_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            //
            if (WindowState == FormWindowState.Minimized)
            {
                WindowState = FormWindowState.Maximized;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void timer1_Tick(object sender, EventArgs e)
        {
            //
            lblTime.Text = "    " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "    ";
        }

        #region Function

        /// <summary>
        /// 初始化文本
        /// </summary>
        private void initText()
        {
            Text = "系统名称";
            notifyTCMS.Text = "系统名称";
        }

        /// <summary>
        /// 初始化菜单
        ///  </summary>
        private void InitMenus()
        {
            ribMenu.SelectFirstVisibleRibbonTab();

            #region ---登录系统后，打开默认起始界面---

            OpenMdiChild.OpenWindow(new HomePage(), this);

            #endregion ---登录系统后，打开默认起始界面---
        }

        /// <summary>
        /// 设置系统气泡信息
        /// </summary>
        /// <param name="tipTitle">气泡标题</param>
        /// <param name="tipText">气泡文本内容</param>
        /// <param name="icon">气泡图标</param>
        public void SetNotify(string tipTitle, string tipText, ToolTipIcon icon)
        {
            notifyTCMS.ShowBalloonTip(1000, tipTitle, tipText, icon);
        }
        #endregion

        private void buttonItem102001_Click(object sender, EventArgs e)
        {

        }

        

    }
}
